﻿using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Formatting;
using Newtonsoft.Json;
using ProtoBuf;

namespace Sustainalytics.ESGRatings.DataContract.ESG
{

    [ProtoContract]
    public class ESGRatingsDto
    {
        [ProtoMember(1)]
        public IndicatorsGroupsDto IndicatorsGroups { get; set; }

        [ProtoMember(2)]
        public string[] IndicatorsCodes { get; set; }

        [ProtoMember(3)]
        public List<CompanyIdicatorsDto> Indicators { get; set; }

        [ProtoMember(4)]
        public List<CompanyRatingDto> Ratings { get; set; }

        [ProtoMember(5)]
        public GroupRatingDto[] Groups { get; set;}

        [ProtoMember(6)]
        public Guid SetId { get; set; }

        public ESGRatingsDto()
        {
            Indicators = new List<CompanyIdicatorsDto>();
            Ratings = new List<CompanyRatingDto>();
            Groups = new GroupRatingDto[]{};
        }

        public override string ToString()
        {
           var result= new ObjectContent<string>(JsonConvert.SerializeObject(this),
                new JsonMediaTypeFormatter());
            return result.ReadAsStringAsync().Result.Replace(@"\""",@"""");
        }
    }


    
}


